function plots2PDF(handleVec, outName, outPath)
% Function to print plots referenced in handleVec to a PDF named
% "outName.pdf" in the directory "outPath".
% ===============================================================
% handleVec: vector of plot handles to print
% outName: name of file to print to (.pdf optional)
% outPath: (optional, defaults to cwd)
% ================================================================
cwd = cd;
if nargin < 3 
    outPath = cwd;
end

if isempty(regexp(outName,'.pdf'))
    outName = horzcat(outName,'.pdf');
end

nFigs = length(handleVec);
figCell = cell(nFigs,1);

cd(outPath)
for k = 1:nFigs
    figCell{k} = horzcat('figMatt',num2str(k),'.pdf');
    print(handleVec(k), '-dpdf', figCell{k});
end

mergePDF(figCell, outName, true);

% if ~strcmp(cd, outPath)
%     copyfile(outName, outPath);
% end
cd(cwd);
end